package com.randi.file.service;

import com.randi.file.entity.vo.FileSliceMergeVo;
import com.randi.file.entity.vo.FileSliceUploadCheckVo;
import com.randi.file.entity.vo.FileSliceUploadVo;
import com.randi.file.entity.vo.FileUploadVo;
import com.randi.file.enums.FileSliceMergeStatusEnum;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @author ziye
 */
public interface ISysFileUploadService {

    /**
     * 文件上传
     *
     * @param fileUpload fileUploadVo
     * @return 文件路径
     * @throws IOException IO异常
     */
    String simpleUpload(FileUploadVo fileUpload) throws IOException;

    /**
     * 指定路径文件上传
     *
     * @param fileUpload fileUploadVo
     * @param pathName   文件路径
     * @return 是否成功
     * @throws IOException IO异常
     */
    String simpleUploadByFolder(FileUploadVo fileUpload, String pathName) throws IOException;

    /**
     * 分片上传校验
     *
     * @param fileHash 文件哈希
     * @return Result
     */
    FileSliceUploadCheckVo sliceUploadCheck(String fileHash);

    /**
     * 分片上传
     *
     * @param fileChunkUpload fileChunkUploadVo
     * @return 结果
     */
    Boolean sliceUpload(FileSliceUploadVo fileChunkUpload);

    /**
     * 分片合并
     *
     * @param sliceMerge FileSliceMergeVo
     * @return 任务ID
     */
    String sliceMerge(FileSliceMergeVo sliceMerge);

    /**
     * 分片合并校验
     *
     * @param taskId 任务ID
     * @return 校验结果
     */
    FileSliceMergeStatusEnum sliceMergeVerify(String taskId);
}
